<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div style="width:100px;height:100px;background:red">

    </div>
    <button onclick="aaa()">点我</button>
</body>
<script>
    var div = document.getElementsByTagName('div')[0];
    //鼠标进入目标触发的事件，相当于onmouseover
    div.onmouseenter = function(){
        div.style.background = 'yellow';
    }
    //鼠标移出目标触发的事件，相当于onmouseout
    div.onmouseleave = function(){
        div.style.background = 'blue';
    }
    function aaa(){
        console.log("点击了")
    }
</script>
</html>